<script type="text/javascript">
    document.observe("dom:loaded", function() {
       $('txtSearch').focus();
       $('txtSearch').select();
    });
</script>
<div id="search">
  <div class="hd"><h3>Search</h3></div>
  <div class="bd">
    <% form_tag request.path,:action=>"search", :method=> 'get' do %>
      <label for="txtSearch">Search for:</label>
      <input type="text" id="txtSearch" name="txtSearch" class="textentry" value="<%=params[:txtSearch]%>"/>
      <%=select_tag("searchOn", options_for_select({"Last Name" => "last_name","Birth Date" => "birth_date"},params[:searchOn]),:class=>"dropdown") %>
      <input type="submit" id="btnSearch" name="btnSearch" alt="Search" value="Search" class="button"/>
    <% end %>
  </div>
</div>
<div id="grid">
  <table id="tblPatients" class="listTable">
    <thead>
      <tr>
        <td>First Name</td>
        <td>Last Name</td>
        <td>Birth Date</td>
        <td>Race</td>
        <td>Diagnosis</td>
        <td>Actions</td>
      </tr>
    </thead>
    <tbody>
      <%- for patient in @patients -%>
        <tr>
          <td><%=patient.first_name %></td>
          <td><%=patient.last_name %></td>
          <td><%=patient.birth_date%></td>
          <td><%=patient.race.race_description%></td>
          <td><%=patient.diagnosis.disease_name%></td>
          <td><%= link_to 'Edit', edit_patient_path(patient) %>
          <%= link_to "Delete", patient, :confirm => "Are you sure you want to delete #{patient.first_name + " " + patient.last_name}?", :method => :delete %></td>
        </tr>
      <%- end -%>
      <tr>
        <td colspan="6"><%= will_paginate @patients %></td>
      </tr>
    </tbody>
  </table>
</div>
<div id="functions">
  <input type="button" id="btnAddPatient" name="btnAddPatient" value="Add Patient" onclick="javascript:window.location = '/patients/new/';"/>
</div>
<div id="detail">
  <div id="patient_details" class="yui-navset"></div>
</div>